package com.bzkj.web.controller.ncc;

import com.bzkj.basicinfo.domain.ncc.NccBasicManufacturerInfo;
import com.bzkj.basicinfo.service.ncc.NccBasicManufacturerInfoService;
import com.bzkj.common.core.controller.BaseController;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.core.page.TableDataInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ncc/basic/manufacturerInfo")
public class NccBasicManufacturerInfoController extends BaseController
{

    @Autowired
    private NccBasicManufacturerInfoService manufacturerInfoService;

    /**
     * NCC工厂 组织信息定时任务
     */
    @GetMapping({"/nccBasicManufacturerInfoJob", "/nccBasicManufacturerInfoJob/{all}"})
    @PreAuthorize("@ss.hasPermi('ncc:ManufacturerInfo:Job')")
    public void nccBasicManufacturerInfoJob(@PathVariable(required = false) String all)
    {
        manufacturerInfoService.updateNccBasicManufacturerInfoJob(all);
    }


    /**
     * 根据条件分页查询集团企业信息
     *
     * @Author wangzhichao
     * @Date 2024/12/09 14:54:30
     * @Param entity
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:query')")
    @GetMapping("findNccBasicManufacurerInfoData")
    public TableDataInfo findNccBasicManufacurerInfoData(NccBasicManufacturerInfo entity)
    {
        startPage();
        return getDataTable(manufacturerInfoService.findNccBasicManufacurerInfoData(entity));
    }

    /**
     * 根据code修改集团信息
     *
     * @Author wangzhichao
     * @Date 2024/12/09 14:58:32
     * @Param entity
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:edit')")
    @PutMapping("nccBasicManufacurerInfoUpdate")
    public AjaxResult nccBasicManufacurerInfoUpdate(@RequestBody NccBasicManufacturerInfo entity)
    {
        return manufacturerInfoService.nccBasicManufacurerInfoUpdate(entity);
    }

    /**
     * 新增集团信息
     *
     * @Author wangzhichao
     * @Date 2024/12/10 09:03:57
     * @Param entity
     */
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:add')")
    @PostMapping("nccBasicManuFacurerInfoSave")
    public AjaxResult nccBasicManuFacurerInfoSave(@RequestBody NccBasicManufacturerInfo entity)
    {
        return manufacturerInfoService.nccBasicManuFacurerInfoSave(entity);
    }

    /**
     * 查询所有集团信息
     *
     * @return
     */
    @ApiOperation("查询所属企业下拉接口")
    @PreAuthorize("@ss.hasPermi('basic:nccBasic:query')")
    @GetMapping("findBasicManufacturerInfo")
    public R findBasicManufacturerInfo()
    {
        return manufacturerInfoService.findBasicManufacturerInfo();
    }

    /**
     * 定时同步工厂组织信息
     * @return
     */
    @GetMapping("jobMethodExecute")
    public R jobMethodExecute(){
        return manufacturerInfoService.jobMethodExecute();
    }

}
